export function formatBeijingCompact(iso?: string | null) {
  if (!iso) return '';
  // Expected format: 2025-09-25 22:02:54
  return iso.replace('T', ' ').slice(0, 19);
}

export function skillToLabel(skill?: string | null) {
  if (!skill) return '';
  switch (skill) {
    case 'storyteller':
      return 'Storyteller';
    case 'socratic_tutor':
      return 'Socratic Tutor';
    case 'improv':
      return 'Improv';
    default:
      return skill;
  }
}

// Persona name mapping function
export function getPersonaDisplayName(personaSnapshot: any): string {
  if (!personaSnapshot?.name) return 'Unknown Persona';
  
  // Simplified persona name mapping, keeping only commonly used ones
  const nameMap: { [key: string]: string } = {
    'Harry Potter': 'Harry Potter',
    'Socrates': 'Socrates',
    'Sherlock Holmes': 'Sherlock Holmes',
    'Einstein': 'Einstein',
    'Napoleon': 'Napoleon',
    'Shakespeare': 'Shakespeare',
    'Confucius': 'Confucius',
    'Buddha': 'Buddha',
    'Gandhi': 'Gandhi',
    'Marie Curie': 'Marie Curie',
    'Leonardo da Vinci': 'Leonardo da Vinci',
    'Newton': 'Newton',
    'Darwin': 'Darwin',
    'Tesla': 'Tesla',
    'Edison': 'Edison',
    'Mozart': 'Mozart',
    'Beethoven': 'Beethoven',
    'Picasso': 'Picasso',
    'Van Gogh': 'Van Gogh',
    'Mona Lisa': 'Mona Lisa',
    'Romeo': 'Romeo',
    'Juliet': 'Juliet',
    'Hamlet': 'Hamlet',
    'Macbeth': 'Macbeth',
    'Othello': 'Othello',
    'King Lear': 'King Lear',
    'Ariel': 'Ariel',
    'Cinderella': 'Cinderella',
    'Snow White': 'Snow White',
    'Sleeping Beauty': 'Sleeping Beauty',
    'Belle': 'Belle',
    'Jasmine': 'Jasmine',
    'Mulan': 'Mulan',
    'Pocahontas': 'Pocahontas',
    'Rapunzel': 'Rapunzel',
    'Elsa': 'Elsa',
    'Anna': 'Anna',
    'Moana': 'Moana',
    'Merida': 'Merida',
    'Tiana': 'Tiana',
    'Aurora': 'Aurora',
    'Wendy': 'Wendy',
    'Peter Pan': 'Peter Pan',
    'Alice': 'Alice',
    'Dorothy': 'Dorothy',
    'Wizard of Oz': 'Wizard of Oz',
    'Tin Man': 'Tin Man',
    'Scarecrow': 'Scarecrow',
    'Cowardly Lion': 'Cowardly Lion',
    'Wicked Witch': 'Wicked Witch',
    'Good Witch': 'Good Witch',
    'Glinda': 'Glinda',
    'Elphaba': 'Elphaba',
    'Fiyero': 'Fiyero',
    'Nessarose': 'Nessarose',
    'Boq': 'Boq',
    'Madame Morrible': 'Madame Morrible',
    'Doctor Dillamond': 'Doctor Dillamond',
    'Chistery': 'Chistery'
  };
  
  return nameMap[personaSnapshot.name] || personaSnapshot.name;
}